function main() {


    if (false)
    {
        var dlopen = Module.findExportByName(null, "dlopen")
        console.log("dlopen", dlopen)
        Interceptor.attach(dlopen, {
            onEnter: function (args) {

                var fileName = ptr(args[0]).readCString()
                console.log(fileName)


            }, onLeave: function (ret) {

                return ret
            }
        })
    }

    if (false)
    {
        var dlopen_ext = Module.findExportByName(null, 'android_dlopen_ext')
        Interceptor.attach(dlopen_ext, {
            onEnter: function (args) {

                var fileName = ptr(args[0]).readCString()
                console.log(fileName)

            }, onLeave: function (ret) {

                return ret
            }
        })
    }

    if (false)
    {
        var fopen = Module.findExportByName(null, 'fopen')
        Interceptor.attach(fopen, {
            onEnter: function (args) {

                var fileName = ptr(args[0]).readCString()
                console.log(fileName)

                console.log(
                    Thread.backtrace(this.context, Backtracer.ACCURATE)
                        .map(DebugSymbol.fromAddress).join('\n') + '\n')

            }, onLeave: function (ret) {

                return ret
            }
        })
    }

    {
        var strcmp = Module.findExportByName("libc.so", 'strcmp')

        Interceptor.attach(strcmp, {
            onEnter: function (args) {

                var str1 = Memory.readCString(args[0])
                if (str1.length >10){
                    console.log('------------strcmp-------------')
                    console.log(str1)
                    console.log(Memory.readCString(args[1]))
                }

                //   console.log(args[1])

            }, onLeave: function (ret) {

                return ret
            }
        })
    }

    if (false)
    {
        var clock_gettime = Module.findExportByName("libc.so", 'clock_gettime')
        Interceptor.attach(clock_gettime, {
            onEnter: function (args) {

                console.log(args[0])

            }, onLeave: function (ret) {

                return ret
            }
        })
    }

    var speed = 1
    var last_time = 0
    var curr_time = 0
    var curr_ms = 0
    var curr_s = 0
    var outbufferptr
    if (false)
    {
        var gettimeofday = Module.findExportByName("libc.so", 'gettimeofday')
        Interceptor.attach(gettimeofday, {
            onEnter: function (args) {

                outbufferptr  = (args[0])


            }, onLeave: function (ret) {
                // 5fc45091 -> 1606701201 -> 0x9150c45f -> 0x91,0x50,0xc4,0x5f,0x15,0x97,0x09,0x00
                //61cec385      1640940785              ->85 c3 ce 61 2d 52 0a 00

                //  console.log("---- base ---- ");
                // console.log(hexdump(outbufferptr, { length: 8, ansi: true }));
                // Memory.writeByteArray(outbufferptr,[0x91,0x50,0xc4,0x5f,0x15,0x97,0x09,0x00]);

                curr_s =  Memory.readLong(outbufferptr)
                curr_ms =  Memory.readLong(outbufferptr.add(4))
                // console.log(curr_s)
                // console.log(curr_ms)
                curr_time = curr_s*1000000+curr_ms
                if (last_time==0)last_time=curr_time
                var tmp = curr_time -last_time
                curr_time = curr_time + tmp*speed
                last_time = curr_time
                // console.log(curr_s)
                // console.log(curr_ms)
                // console.log(curr_time)

                Memory.writeLong(outbufferptr,curr_time/1000000)
                Memory.writeLong(outbufferptr.add(4),curr_time%1000000)
                curr_s =  Memory.readLong(outbufferptr)
                curr_ms =  Memory.readLong(outbufferptr.add(4))

                // console.log(curr_s)
                // console.log(curr_ms)
                // console.log("----------------------------")

                // console.log(curr_ms)
                // if (last_ms==0)last_ms=curr_ms
                //
                // var tmp = curr_ms - last_ms
                // curr_ms = curr_ms + speed*tmp
                // last_ms = curr_ms
                // console.log(curr_ms)
                // console.log(Memory.readLong(outbufferptr));
                //  console.log(Memory.readLong(outbufferptr.add(4)));
                //  var tmp = Memory.readLong(outbufferptr.add(4))+100;

                // Memory.writeLong(outbufferptr.add(4),curr_ms)
                // curr_ms =  Memory.readLong(outbufferptr.add(4))
                // console.log(curr_ms)


                // Memory.writeByteArray(outbufferptr.add(4),curr_ms);
                // var tmp = curr_ms - last_ms
                // console.log("---- modify ---- ");

                // curr_ms = curr_ms + tmp*2
                // last_ms= curr_ms
                //  console.log(Memory.readLong(outbufferptr))
                //   console.log("---- modify ---- ")
                //    Memory.writeLong(outbufferptr , curr_ms)

                //  console.log("---- modify ---- ");
                //  console.log(hexdump(outbufferptr, { length: 8, ansi: true }));


                return ret
            }
        })
    }

    var send = Module.findExportByName("libc.so", 'send')
    Interceptor.attach(send, {
        onEnter: function (args) {

            console.log(args[0])

        }, onLeave: function (ret) {

            return ret
        }
    })
}

setImmediate(main)

// frida -U --no-pause -f  com.tencent.dm -l hooklibc.js
// frida -U --no-pause -f  com.xingin.xhs -l hooklibc.js
// frida -U --no-pause -f  com.tencent.mm -l hooklibc.js
// frida -U --no-pause -f  com.ss.android.ugc.aweme -l hooklibc.js
// frida -U --no-pause -f  com.mmzztt.app -l hooklibc.js


// frida -U --no-pause -f  com.ggsg.aligames -l hooklibc.js
// frida -U --no-pause -f  com.diyibo.snmj.aligames -l hooklibc.js
// frida -U --no-pause -f  com.youzu.snxyj.x7sy -l hooklibc.js
// frida -U --no-pause -f  com.youzu.snxyj.x7sy -l hooklibc.js
// frida -U --no-pause -f  com.yrtgame.stickvar.aligames -l hooklibc.js